package com.sawyerqiu.model;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.util.DateUtils;
import com.sawyerqiu.constant.DateConstant;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author sawyerQiu
 */
public class OrderExcelData implements ToWordParam, IntNo {

    private int no;

    @DateTimeFormat("yyyy/MM/dd")
    private Date date;

    private String occupy0;

    private String buyer;

    private String goods;

    @NumberFormat(value = "#.00")
    private float weight;

    @NumberFormat(value = "#.00")
    private float originPride;

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getBuyer() {
        return buyer;
    }

    public void setBuyer(String buyer) {
        this.buyer = buyer;
    }

    public String getGoods() {
        return goods;
    }

    public void setGoods(String goods) {
        this.goods = goods;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    public float getOriginPride() {
        return originPride;
    }

    public void setOriginPride(float originPride) {
        this.originPride = originPride;
    }

    @Override
    public String toString() {
        return "OrderExcelData{" +
                "no=" + no +
                ", date=" + date +
                ", buyer='" + buyer + '\'' +
                '}';
    }

    @Override
    public List<String> getParams() {
        List<String> params = new ArrayList<>();
        params.add(buyer);
        params.add(DateUtils.format(date, DateConstant.DATE_FORMAT));
        params.add(String.format("%.2f", weight));
        params.add(String.format("%.2f", originPride));
        params.add(String.format("%.2f", weight * originPride));
        return params;
    }
}
